<?php
require_once 'class/common.php';
require_once 'class/PHONGBAN.php';
$depts = PHONGBAN::Select();
EchoHeader();
?>
<style type="text/css">
	.tablist input[type="text"] { width: 95%; }
	
	.tablist { margin-bottom: 12px; }
	
	body { padding: 10px; }
	
	#dlgNhanVien * { font-family: Verdana; }
</style>

<script type="text/javascript">
	$(function () {
		// init date-picker control
		$('#NgaySinh').datepicker({
			inline: true,
			dateFormat: "dd/mm/yy"
		});

		// init dialog
		$( "#dlgNhanVien" ).dialog({
			autoOpen: false,
			width: 350,
			modal: true,
			buttons: {
				"Lưu": updateNhanVien,
				"Hủy": function() { $( this ).dialog( "close" ); }
			},
			close: function() {
				
			}
		});
	});

</script>

<p>
	<input type="text" name="keyWord" id="keyWord" onkeypress="onTxtKey(event)" />
	<input type="button" value="Tìm" onclick="onBtnSearch()" />
</p>

<table class="tablist">
	<tr>
		<th><input type="checkbox" name="CheckAll" onClick="onCheckAll(this)"/></th>
		<th>Họ tên</th>
		<th>Ngày sinh</th>
		<th>Địa chỉ</th>
		<th>Phái</th>
		<th>Lương</th>
		<th>Phòng</th>
		<th></th>
	</tr>
	<tr id="frmNhanVien">
		<td><input type="checkbox" name="CheckAll" onClick="onCheckAll(this)"/></td>
		<td><input name="HoTen" id="HoTen" type="text" /></td>
		<td><input name="NgaySinh" id="NgaySinh" type="text" /></td>
		<td><input name="DiaChi" id="DiaChi" type="text"/></td>
		<td>
			<select name="Phai" id="Phai">
				<option value="0">Nam</option>
				<option value="1">Nữ</option>
			</select>
		</td>
		<td><input name="Luong" type="text" id="Luong" onkeypress="return checkNumber(this,10,event);"/></td>
		<td>
			<select name="Phong" id="Phong">
			<?php
			foreach ($depts as $dept)
				echo sprintf('<option value="%d">%s</option>', $dept['MaPhong'], $dept['TenPhong']);
			?>
			</select>
		</td>
		<td><input type="button" value="Thêm" onClick="onBtnAdd()" class="button"/></td>
	</tr>
</table>
<input type="button" value="Xóa" onclick="onBtnDeletes()" class="button"/>

<div id="dlgNhanVien" title="Cập nhật nhân viên">
	<p class="validateTips">Hãy điền vào các mục sau.</p>
	<form>
		<input type="hidden" name="MaNV" id="MaNV2" />
		
		<fieldset>
			<!-- HoTen2 -->
			<div class="field">
				<div class="label"><label for="HoTen2">Họ tên</label></div>
				<div class="input">
					<input id="HoTen2" name="HoTen2" type="text" />
				</div>
			</div>
		
			<!-- NgaySinh2 -->
			<div class="field">
				<div class="label"><label for="NgaySinh2">Ngày sinh</label></div>
				<div class="input">
					<input type="text" name="NgaySinh2" id="NgaySinh2" />
				</div>
			</div>
		
			<!-- DiaChi2 -->
			<div class="field">
				<div class="label"><label for="DiaChi2">Địa chỉ</label></div>
				<div class="input">
					<input type="text" name="DiaChi2" id="DiaChi2" />
				</div>
			</div>
				
			<!-- Phai -->
			<div class="field">
				<div class="label">Phái</div>
				<div class="input">
					<input type="radio" name="Phai" id="Nam" value="0"  checked="checked"/>
					<label for="Nam">Nam</label>
					<input type="radio" name="Phai" id="Nu" value="1" />
					<label for="Nu">Nữ</label>
				</div>
			</div>
			
			<!-- Luong2 -->
			<div class="field">
				<div class="label"><label for="Luong2">Lương</label></div>
				<div class="input">
					<input type="text" name="Luong2" id="Luong2" />
				</div>
			</div>
			
			<!-- Phong -->
			<div class="field">
				<div class="label">Phòng</div>
				<div class="input">
					<select name="Phong2" id="Phong2">
					<?php
					foreach ($depts as $dept)
						echo sprintf('<option value="%d">%s</option>', $dept['MaPhong'], $dept['TenPhong']);
					?>
					</select>
				</div>
			</div>
		</fieldset>
	</form>
</div>
<?php
EchoFooter();
?>